namespace WpfClient.Shared.Utilities
{
    /// <summary>
    /// 日期时间帮助类
    /// </summary>
    public static class DateTimeHelper
    {
        /// <summary>
        /// 获取当前UTC时间
        /// </summary>
        public static DateTime UtcNow => DateTime.UtcNow;

        /// <summary>
        /// 获取当前本地时间
        /// </summary>
        public static DateTime Now => DateTime.Now;

        /// <summary>
        /// 将UTC时间转换为本地时间
        /// </summary>
        public static DateTime ToLocalTime(DateTime utcDateTime)
        {
            return utcDateTime.ToLocalTime();
        }

        /// <summary>
        /// 将本地时间转换为UTC时间
        /// </summary>
        public static DateTime ToUtcTime(DateTime localDateTime)
        {
            return localDateTime.ToUniversalTime();
        }

        /// <summary>
        /// 格式化日期时间为字符串
        /// </summary>
        public static string FormatDateTime(DateTime dateTime, string format = "yyyy-MM-dd HH:mm:ss")
        {
            return dateTime.ToString(format);
        }
    }
}